﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vm="clr-namespace:TFSArtifactManager.ViewModel"
                    xmlns:vw="clr-namespace:TFSArtifactManager.Views">
    
    <DataTemplate DataType="{x:Type vm:ProjectArtifactsViewModel}">
        <vw:ProjectArtifactsView />
    </DataTemplate>

    <DataTemplate DataType="{x:Type vm:DatabasePackagerViewModel}">
        <vw:DatabasePackagerView/>
    </DataTemplate>

    <LinearGradientBrush x:Key="Brush_HeaderBackground" StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Color="#66000088" Offset="0" />
        <GradientStop Color="#BB000088" Offset="1" />
    </LinearGradientBrush>

    <!-- 
  This style configures both of the main content areas in the main window.
  -->
    
    <Style x:Key="MainHCCStyle" TargetType="{x:Type HeaderedContentControl}">
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border 
            Background="{StaticResource Brush_HeaderBackground}" 
            BorderBrush="LightGray" 
            BorderThickness="1" 
            CornerRadius="5" 
            Margin="1" 
            Padding="2" 
            SnapsToDevicePixels="True" 
            >
                        <TextBlock 
              FontSize="14"
              FontWeight="Bold"
              Foreground="White" 
              HorizontalAlignment="Center"  
              Text="{TemplateBinding Content}" 
              />
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <!-- 
        This template ensures that content of a HeaderedContentControl 
        fills the available vertical space. 
        -->
                <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                    <DockPanel>
                        <ContentPresenter 
              DockPanel.Dock="Top"
              ContentSource="Header" 
              ContentTemplate="{TemplateBinding HeaderTemplate}" 
              />
                        <ContentPresenter 
              ContentSource="Content" 
              ContentTemplate="{TemplateBinding ContentTemplate}" 
              />
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!-- 
  This template explains how to render 
  a tab item with a close button.
  -->
    <DataTemplate x:Key="ClosableTabItemTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" MaxWidth="250"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            
            <ContentPresenter Grid.Column="0" Content="{Binding Path=WorkspaceHeader}" VerticalAlignment="Center" />
            
            <Button Grid.Column="1"
            Command="{Binding Path=CloseCommand}"
            Content="X"
            Cursor="Hand"
            DockPanel.Dock="Right"
            Focusable="False"
            FontFamily="Courier" 
            FontSize="9"
            FontWeight="Bold"  
            Margin="8,1,0,0"
            Padding="0"
            VerticalContentAlignment="Bottom"
            Width="16" Height="16"  />
            
        </Grid>
    </DataTemplate>
    <!--
  This template explains how to render the 'Workspace' content area in the main window.
  -->
    <DataTemplate x:Key="WorkspacesTemplate">
        <TabControl IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" ItemTemplate="{StaticResource ClosableTabItemTemplate}" Margin="2" />
    </DataTemplate>
</ResourceDictionary>